package com.eam.controller;

import com.eam.service.EquipmentCycleTimelineService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;
import java.util.List;
import java.util.Map;


@Controller
@RequestMapping("equipmentCycle")
public class EquipmentCycleTimelineController {
	@Autowired
	EquipmentCycleTimelineService cycleTimelineService;
	
	@ResponseBody 
	@RequestMapping(value="searchEquipmentCycle",method=RequestMethod.POST)
	public List<Map<String,Object>> searchEquipmentCycle(String equipmentId){
		return cycleTimelineService.searchEquipmentCycle(equipmentId);
	}
	
	@ResponseBody 
	@RequestMapping(value="searchEquipment",method=RequestMethod.POST)
	public Map<String, Object> searchEquipment(){
		return cycleTimelineService.searchEquipment();
	}
	
	//维保计划报表
	@ResponseBody 
	@RequestMapping(value="maintainPlanDataStatistics",method=RequestMethod.POST)
	public List<Map<String,Object>> maintainPlanDataStatistics(HttpServletRequest request){
		String orgId = (String)request.getSession().getAttribute("OrgId");
		orgId = request.getParameter("orgId");
		return cycleTimelineService.maintainPlanDataStatistics(orgId);
	}
	
	@ResponseBody 
	@RequestMapping(value="equipmentRunLogStatistics",method=RequestMethod.POST)
	public Map<String,Object> equipmentRunLogStatistics(HttpServletRequest request){
		String orgId = (String)request.getSession().getAttribute("OrgId");
		String planDateFrom = request.getParameter("planDateFrom");
		orgId = request.getParameter("orgId");
		return cycleTimelineService.equipmentRunLogStatistics(orgId,planDateFrom);
	}
}
